import request from '@/utils/request'
import qs from 'qs'
export const getMenuListapi = () => request.get('/core/security/menu/list')
export const getMenuItemListapi = params => request.get('/core/security/menu/item/list', { params })
export const getMenuGrantListapi = params => request.get('/core/security/menu/grant/list', { params })
// 新增菜单
export const postAddMenuListapi = data => request.post('/core/security/menu',qs.stringify(data))
// 删除菜单
export const deleteMenuListapi = menuId => request.post(`/core/security/menu/delete?menuId=${menuId}`)
// 修改菜单
export const putMenuListapi = data => request.post('/core/security/menu/put', qs.stringify(data))
// 获取人员树根节点
export const gettreefaestapi = params => request.get('/core/security/organization/manager/page', { params })
// 获取树 组织节点
export const gettreechildapi = params => request.get('/core/security/organization/child/list', { params })
// 获取树 组织节点
export const gettreechildorgapi = params => request.get('/core/security/organization/child/org/list', { params })
// 获取树 人员节点
export const gettreeuserapi = params => request.get('/core/security/user/list', { params })
// 组织授权
export const postgrantorganizationapi = data => request.post('/core/security/menu/grant-organization', qs.stringify(data)) 
// 人员授权
export const postgrantuserapi=data=>request.post('/core/security/menu/grant-user', qs.stringify(data))
// 删除组织授权
export const deletegrantorganizationapi = grantId => request.post(`/core/security/menu/grant/delete?grantId=${grantId}`)
// 获取菜单
export const getitemlistapi = params => request.get('/core/security/menu/item/list', { params })
// 获取树
export const getalltreeapi = () => request.get('/core/security/function/tree')
// 新增树
export const postaddtreeapi = data => request.post('/core/security/menu/folder-item', qs.stringify(data))
// 修改树
export const postputtreeapi = data => request.post('/core/security/menu/item/put', qs.stringify(data))
// 删除树
export const postdeletetreeapi = itemId => request.post(`/core/security/menu/item/delete?itemId=${itemId}`)
//添加菜单项
export const postfunctionitem=data=>request.post('/core/security/menu/function-item',qs.stringify(data))